package com.macro.mall.service;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.AgentSkuListResult;
import com.macro.mall.dto.*;
import com.macro.mall.model.OmsOrder;
import com.macro.mall.model.OmsOrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 订单管理Service
 */
public interface OmsOrderService {
    /**
     * 订单查询
     */
    List<OmsOrder> list(OmsOrderQueryParam queryParam, Integer pageSize, Integer pageNum);

    /**
     * 批量发货
     */
    @Transactional(rollbackFor = RuntimeException.class)
    int delivery(List<OmsOrderDeliveryParam> deliveryParamList);

    /**
     * 批量关闭订单
     */
    @Transactional
    int close(List<Long> ids, String note);

    /**
     * 批量删除订单
     */
    int delete(List<Long> ids);

    /**
     * 获取指定订单详情
     */
    OmsOrderDetail detail(Long id);

    /**
     * 修改订单收货人信息
     */
    @Transactional
    int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam);

    /**
     * 修改订单费用信息
     */
    @Transactional
    int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam);

    /**
     * 修改订单备注
     */
    @Transactional
    int updateNote(Long id, String note, Integer status);

    /**
     * 单个发货
     * @author zhouboyu
     * @Date 2020年9月11日
     *
     * @param deliveryParam
     * @return
     */
    @Transactional(rollbackFor = RuntimeException.class)
    int deliveryOne(OmsOrderDeliveryParam deliveryParam);

    /**
     * 通过订单id查询订单下的商品及库存明细
     */
    CommonResult<List<OmsOrderItemDTO>>  deliveryData(Long orderId, Long agentId);


    /**
     * 解除订单商品库存锁定
     * 区分普通商品和组合商品
     * @param orderItemList
     */
    void releaseSkuStockLock(List<OmsOrderItem> orderItemList);

    /**
     * 把一个订单归到某个经纪人下
     * @author 高强
     * @date 2021/1/8 11:03
     * @param orderId: 订单id
     * @param agentId: 经纪人id
     * @return com.macro.mall.common.api.CommonResult
     */
    CommonResult giveOrderToAgent(Long orderId, Long agentId);
}
